<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>测试cors解决跨域</title>
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
	</head>
	<body>
		<h2>该页面练习：测试cors解决跨域</h2>
		<button onclick="getData()">获取信息</button> <br></br>
		
		<script type="text/javascript" >
			function getData(){
				$.ajax({
					url:'http://localhost:5002/hello',
					method:'GET',
					headers:{demo:999},
					success(data){
						console.log(data)
					},
					error(){
						console.log('失败了')
					}
				})
			}
		</script>
	</body>
</html>